#include <stdio.h>
/**
 * 输入n个成绩
 * 换行输出n个成绩中最高分数和最低分数的差
 */
int main(int argc, char const *argv[])
{
    int n = 0;
    int scores[10000];

    scanf("%d", &n);
    
    for(int i = 0; i < n; i++) {
        scanf("%d", &scores[i]);
    }
    int max = scores[0];
    int min = scores[0];
    for(int i = 0; i < n; i++) {
        if(scores[i] > max) {
            max = scores[i];
        }
        if (scores[i] < min) {
            min = scores[i];
        }
        
    }
    printf("%d\n", max - min);
    
    return 0;
}
